package com.xcity.game.equip.suit4.impl;

import com.xcity.game.combat.ActionEffect;
import com.xcity.game.combat.ActionEffect.Value;
import com.xcity.game.combat.attr.CombatAttributeType;
import com.xcity.game.combat.unit.CombatUnit;
import com.xcity.game.common.GameStaticConfig;
import com.xcity.game.equip.suit4.BaseSuit4;
import com.xcity.game.equip.template.EquipSuitEffectTemplate;

/**
 * 圣罗兰4件套<br/>
 * 暴击伤害无视{20}%防御<br/>
 * @author yang.li
 *
 */
public class Suit4Ysl extends BaseSuit4 {

	public Suit4Ysl(CombatUnit unit, EquipSuitEffectTemplate template) {
		super(unit, template);
	}

	@Override
	public void preDamage0(ActionEffect effect) {
		if (unit.getId() != effect.ref().getUnitId()) {
			return;
		}
		if (effect.getResult() == ActionEffect.RESULT_CRIT && effect.getHpDelta() < 0) {
			int hpDelta = (int) (effect.getHpDelta() * (1 + template.getSuit4Param(0) / GameStaticConfig.percentBase));
			Value v = effect.getValue(CombatAttributeType.HP);
			v.setDelta(hpDelta);
		}
	}

}
